package com.kreateinfinity.msdi.util;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.apache.log4j.Logger;

/**
 * Application Lifecycle Listener implementation class SessionListener
 *
 */
public class NISSessionListener implements HttpSessionListener {
	private static Logger LOGGER = Logger.getLogger(NISSessionListener.class.getName());
    /**
     * Default constructor. 
     */
    public NISSessionListener() {
      
    }

	/**
     * @see HttpSessionListener#sessionCreated(HttpSessionEvent)
     */
    public void sessionCreated(HttpSessionEvent arg0) {
    	LOGGER.info("::::::::::::::Session Created::::::::::::::::");
    	arg0.getSession().setMaxInactiveInterval(1800);
        
    }

	/**
     * @see HttpSessionListener#sessionDestroyed(HttpSessionEvent)
     */
    public void sessionDestroyed(HttpSessionEvent arg0)
    			{    	
    			LOGGER.info("::::::::::::Session Destroyed:::::::::::");
    			/*HttpSession session = arg0.getSession(); 
    			if(session!=null) {
    				session.invalidate();
    			} */
        
    }
	
}
